package bg.tu.varna.pms.model.communication;

import java.io.Serializable;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.UUID;

public final class ChatMessage {
	public final static class Request implements Serializable {
		private static final long serialVersionUID = 455755227308051486L;
		private final bg.tu.varna.pms.model.ChatMessage mMessage;

		public Request(bg.tu.varna.pms.model.ChatMessage message) {
			mMessage = message;
		}

		public bg.tu.varna.pms.model.ChatMessage getMessage() {
			return mMessage;
		}
	}

	/**
	 * Delivery notification (delivery to server)
	 * 
	 * @author Gospodin Gospodinov
	 */
	public final static class Response implements Serializable {
		private static final long serialVersionUID = 4018492009115161521L;
		private final String mChatRoomID;
		private final UUID mMessageID;
		private final boolean mReceived;

		public Response(String chatRoomID, UUID messageID, boolean received) {
			mChatRoomID = chatRoomID;
			mMessageID = messageID;
			mReceived = received;
		}

		public String getChatRoomID() {
			return mChatRoomID;
		}

		public UUID getMessageID() {
			return mMessageID;
		}

		public boolean isReceived() {
			return mReceived;
		}
	}

	/**
	 * Delivery notification (to be routed to original sender)
	 * 
	 * @author Gospodin Gospodinov
	 */
	public final static class Delivery implements Serializable {
		private static final long serialVersionUID = 5676137969432675072L;
		private final String mChatRoomID;
		private final UUID mMessageID;
		private final String mReceiver;
		private final Calendar mReceiveDate;
		private final boolean mReceived;

		public Delivery(String chatRoomID, UUID messageID, String receiver,
				boolean received) {
			mChatRoomID = chatRoomID;
			mMessageID = messageID;
			mReceiver = receiver;
			mReceiveDate = GregorianCalendar.getInstance();
			mReceived = received;
		}

		public String getChatRoomID() {
			return mChatRoomID;
		}

		public UUID getMessageID() {
			return mMessageID;
		}

		public String getReceiver() {
			return mReceiver;
		}

		public Calendar getReceiveDate() {
			return mReceiveDate;
		}

		public boolean isReceived() {
			return mReceived;
		}
	}
}
